package com.dhu.demo.service;

import com.dhu.demo.entity.Student;
import com.dhu.demo.entity.StudentWithScore;
import com.dhu.demo.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class StudentService {

    @Autowired(required = false)
    private StudentMapper studentMapper;

    public List<Student> findAll(){
        return studentMapper.findAll();
    }

    //增加查找该用户信息的函数
    public Student selectStudnetInfoByStudentNumber(Integer number){
        return studentMapper.selectByStudentNumber(number);
    }
    public int insert(Student record){ return studentMapper.insert(record); }
    public int updateByPrimaryKey(Student record){ return studentMapper.updateByPrimaryKey(record); }
    public int deleteByPrimaryKey(int studentNumber){ return studentMapper.deleteByPrimaryKey(studentNumber); }

    public List<StudentWithScore> selectAllInfoAndScoreByScore(int score){return studentMapper.selectAllInfoAndScoreByScore(score);}
    public List<StudentWithScore> selectAllInfoAndScoreByClassnameAndGrade(StudentWithScore record){return studentMapper.selectAllInfoAndScoreByClassnameAndGrade(record);}

    public List<StudentWithScore> selectScoreMapByClassNumber(String department,String major,String classnumber){return studentMapper.selectScoreMapByClassNumber(department,major,classnumber);}
    public List<StudentWithScore> selectScoreMapByDepartment(String department){return studentMapper.selectScoreMapByDepartment(department);}
    public List<StudentWithScore> selectScoreMapByMajor(String department,String major){return studentMapper.selectScoreMapByMajor(department,major);}
    public List<StudentWithScore> selectScoreMapByClassName(String classname){return studentMapper.selectScoreMapByClassName(classname);}
}
